Comment on the output of this C code? int main() { int a[5] = {1, 2, 3, 4, 5}; int i; for (i = 0; i < 5; i++) if ((char)a[i] == '5') printf("%d ", a[i]); else printf("FAIL "); }

Question:
Comment on the output of this C code?

int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d
", a[i]);
else
printf("FAIL
");
}

1.The compiler will flag an error

2.Program will compile and print the output 5

3.Program will compile and print the ASCII value of 5

4.Program will compile and print FAIL for 5 times

Posted Date:-2022-03-21 14:48:52


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!